package com.ganee.agora.viewmodel

import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.ganee.agora.model.CommentEntity

import com.ganee.agora.repository.SettingsRepository
import com.ganee.agora.repository.TidbitsRepository
import com.ganee.agora.repository.WelcomeRepository
import com.ganee.baselib.httprequest.callback.RequestCallback
import com.ganee.baselib.mvvmlibrary.base.BaseRepository
import com.ganee.baselib.mvvmlibrary.base.BaseViewModel
import okhttp3.RequestBody

class TidbitsViewModel(application: Application) : BaseViewModel<TidbitsRepository>(application) {

    var commentList = MutableLiveData<List<CommentEntity>>()
    var commentValue = MutableLiveData<CommentEntity>()

    override fun getRepository(): TidbitsRepository {
        return TidbitsRepository(this)
    }

    //请求详情
    fun getCommentList(body: RequestBody) {
        mRepository.getCommentList(body,RequestCallback<List<CommentEntity>> {
            commentList.value = it
        })
    }

    //请求详情
    fun postComment(body: RequestBody) {
        mRepository.postComment(body,RequestCallback<CommentEntity> {
            commentValue.value = it
        })
    }
}
